package com.planet.biz;

import com.planet.db.dao.SysUserDOMapper;
import com.planet.db.model.SysUserDO;
import com.planet.facade.SysUserBiz;
import com.planet.query.SysUserQuery;
import com.planet.utils.CommonConverter;
import com.planet.vo.SysUserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by jiayazi on 17/11/13.
 */
@Component("SysUserBiz")
public class SysUserBizImpl implements SysUserBiz {

    @Autowired
    SysUserDOMapper sysUserDOMapper;

    @Override
    public int insertSelective(SysUserQuery sysUserQuery) {
        return sysUserDOMapper.insertSelective(sysUserQuery);
    }

    @Override
    public SysUserVO selectByPrimaryKey(String userId) {
        SysUserDO sysUserdo =  sysUserDOMapper.selectByPrimaryKey(userId);
        SysUserVO sysUserVO = new SysUserVO();
        CommonConverter.convert(sysUserdo, sysUserVO);
        return sysUserVO;
    }

    @Override
    public String login(String userName, String passWord) {
        return sysUserDOMapper.login(userName,passWord);
    }
}
